<template>
	
		<view class="box">
			<view class="cu-bar btn-group">
				<button class="cu-btn bg-green shadow-blur round lg" style="margin-top: 200upx;" @click="toscan()">扫码</button>
			</view>

		</view>	
	
	
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			this.toscan()
		},
		methods: {
				toscan: function(event) {
                 uni.scanCode({
                 onlyFromCamera: true,
                 success: function (res) {
                 console.log('条码类型：' + res.scanType);
                 console.log('条码内容：' + res.result);
				 
				 uni.navigateTo({
                   url: '/pages/gourl/gourl?id='+res.result
                     });
					 
                     }
					 
                     });

		         }
				 
				 }
				 
	             }	
</script>

<style>
</style>
